#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> lucky_pair;

struct comp {
    bool operator() (lucky_pair& a, lucky_pair& b) {
        if (a.second >= b.second) {
            return true;
        } else {
            return false;
        }
    }
};

int cal_lucky_value(string& str) {
    int lucky = 0;
    for (auto ch:str){
        if (ch >= 'a' && ch <= 'z') {
            lucky += (int)(ch-'a') + 1;
        } else {
            lucky += (int)(ch-'A') + 1;
        }
    }
    return lucky;
}

int main() {
    string input;
    vector<string> people;
    // cin >> input;

    // int begin =0; 
    // int end = 0;
    // while (end < input.length()) {
    //     if (input[end] == ' ') {
    //         people.push_back(input.substr(begin, end-begin));
    //         end++;
    //         begin = end;
    //     } else {
    //         end++;
    //     }
    // }
    // people.push_back(input.substr(begin, end-begin));
    for (int i = 0; i < 6; ++i) {
        cin >> input;
        people.push_back(input);
    }
    // for (auto i:people) {
    //     cout << i << endl;
    // }
    int lucky;
    lucky = cal_lucky_value(people[0]);
    vector<lucky_pair> luck_people(5);
    for (int i = 1; i < people.size(); ++i) {
        luck_people[i-1].first = people[i];
        luck_people[i-1].second = abs(cal_lucky_value(people[i])-lucky);
    }
    sort(luck_people.begin(), luck_people.end(), comp());
    cout << luck_people.back().first;
    return 0;
}